import { http } from '@/common/service/service.js'

// 员工管理相关API
export const employeeApi = {
  // 获取员工列表
  getList(params) {
    return http.get('/mes/employee/list', params)
  },

  // 获取员工详情
  getDetail(id) {
    return http.get(`/mes/employee/detail/${id}`)
  },

  // 创建员工
  create(data) {
    return http.post('/mes/employee/create', data)
  },

  // 更新员工
  update(id, data) {
    return http.put(`/mes/employee/update/${id}`, data)
  },

  // 删除员工
  delete(id) {
    return http.delete(`/mes/employee/delete/${id}`)
  },

  // 重置密码
  resetPassword(id) {
    return http.post(`/mes/employee/reset-password/${id}`)
  }
}

// 工种管理相关API
export const workTypeApi = {
  // 获取工种列表
  getList(params) {
    return http.get('/mes/work-type/list', params)
  },

  // 创建工种
  create(data) {
    return http.post('/mes/work-type/create', data)
  },

  // 更新工种
  update(id, data) {
    return http.put(`/mes/work-type/update/${id}`, data)
  },

  // 删除工种
  delete(id) {
    return http.delete(`/mes/work-type/delete/${id}`)
  }
}

// 技能认证相关API
export const skillApi = {
  // 获取技能认证记录
  getList(params) {
    return http.get('/mes/skill/list', params)
  },

  // 申请技能认证
  apply(data) {
    return http.post('/mes/skill/apply', data)
  },

  // 审核技能认证 - 通过
  approve(id, data) {
    return http.post(`/mes/skill/approve/${id}`, data)
  },

  // 审核技能认证 - 拒绝
  reject(id, data) {
    return http.post(`/mes/skill/reject/${id}`, data)
  }
}
